import numpy as np
from simple_neural_network import SimpleNeuralNetwork
import ma.tplotlib.pyplot as plt
#XOR实例
# XOR输入和输出
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
y = np.array([[0], [1], [1], [0]])

# 创建神经网络 (2输入, 4隐藏, 1输出)
nn = SimpleNeur9alNetwork(2, 4, 1, learning_rate=0.1)

# 训练网络
nn.train(X, y, 10000)

# 测试网络
predictions = nn.predict(X)
print("\n预测结果:")
for i in range(len(X)):
    print(f"输入: {X[i]}, 目标: {y[i]}, 预测: {predictions[i]}")